﻿using Learun.Util;
using Learun.Util.SqlSugar;
using SqlSugar;
using System;
using static Learun.Application.TwoDevelopment.ZZDT_EC.IO_WorkFlowService;

namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 动作。和状态是两码事情。
    /// </summary>
    public enum Action
    {

        新增 = 0,
        修改 = 1,
        准备删除 = 2,
        撤销删除 = 3,
        删除 = 4,
        关联通道 = 5,
        审核 = 6,
        重新打开 = 7,
        关联解除 = 8,
        回收站恢复 = 9
    }

    /// <summary>
    /// 信号的通知。给对方专业
    /// </summary>
    [SugarTable(TableName = "ec_wire_group_notice")]
    public class ec_wire_group_noticeEntity
    {
        public ec_wire_group_noticeEntity()
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="action"></param>
        /// <param name="departmentRetrieveNotice">接收方</param>
        /// <param name="WireGroupID"></param>
        public ec_wire_group_noticeEntity(Action action, Department departmentRetrieveNotice, string WireGroupID)
        {
            ActionID = action;
            CompanyID = departmentRetrieveNotice;
            this.WireGroupID = WireGroupID;

        }

        #region 实体成员
        /// <summary>
        /// 信号表通知ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string WireGroupNoticeID { get; set; }
        /// <summary>
        /// 信号ID
        /// </summary>
        /// <returns></returns>
        public string WireGroupID { get; set; } = "";
        /// <summary>
        /// 动作
        /// </summary>
        /// <returns></returns>
        [SugarColumn(ColumnName = "Action")]
        public Action ActionID { get; set; }
        /// <summary>
        /// 动作(描述）
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string Action { get; set; }
        /// <summary>
        /// 额外的消息（如删除时，必须要给一个删除理由）
        /// </summary>
        /// <returns></returns>
        public string Message { get; set; } = "";
        /// <summary>
        /// 是否被确认。false未读。true已读。
        /// </summary>
        public bool CheckFLG { get; set; } = false;
        /// <summary>
        /// 接收者的部门
        /// </summary>
        public Department CompanyID { get; set; }
        /// <summary>
        /// 创建人（也就是发起通知的人）
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人（也就是确认这个消息已阅的人）
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.WireGroupNoticeID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.WireGroupNoticeID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion
        #region 扩展字段
        /// <summary> 
        /// 创建人名称 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string CreateUserName { get; set; }

        /// <summary> 
        /// 批准人名字 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(IsIgnore = true)]
        public string UpdateUserName { get; set; }
        #region 用于前端UI渲染,对应的信号的内容
        [SugarColumn(IsIgnore = true)]
        public string Group_Name { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string Group_Desc { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string Group_Desc_EN { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string IO_Type { get; set; }
        #endregion
        #endregion

    }
}

